import { bindJsonProp, convertToJson, convertToType, dateStringConverter } from ".";


class per {
  name!: string;
  
  @bindJsonProp({ name: 'sex'})
  gender!: string;
}


//////




class User {
  name!: string;
  
  @bindJsonProp({ name: 'sex'})
  gender!: string;

  @bindJsonProp({
    typeConverter: dateStringConverter
  })
  date!: Date;


  @bindJsonProp({ name: '22'})
  per!: per;

}

const jsonData = {name: 'zhangsan', sex: 'male', date: '2020-08-03'};
const user = convertToType(User)(jsonData);

console.log(user)

console.log(convertToJson(user))
